#ifndef ROBOT_H
#define ROBOT_H

#include "cell.h"
#include "path.h"
#include "robotthread.h"
#include <iostream>
class RobotThread;
class Cell;
class Path;
class Robot
{
public:
    Path* path;
    bool isWaiting;
    RobotThread *thread;
    void setPath(Path *path);
    Robot();
    Robot(int id);
    Robot(Robot *r);
    Robot* getRobot(){return this;}
    int getId(){return this->ID;}
    bool hasNextGranted();
    Cell* occupiedCell;
    Cell* getOccupiedCell();
    bool asked4NextCell(){return askForNext;}
    void ask4NextCell(){askForNext=true;}
    void releaseCell();
    bool grantAccessToNextCell();
    int countPath();
    void printRobot();
    void printPath();
    bool isMoving(){return onMove;}
    void move();
    void stopMoving(){onMove=false;}
    void setOnStage(){onStage = true;}
    bool isOnStage(){return onStage;}
    void removeFromStage(){onStage=false;}
    void addCellToPath(Cell* cell);
private:
    int ID;
    bool askForNext;
    bool grantedAccess;
    bool onMove;
    bool onStage;
};

#endif // ROBOT_H
